<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Basic DataGrid - jQuery EasyUI Demo</title>
    <link rel="stylesheet" type="text/css" href="static/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="static/easyui/themes/icon.css">
    <script type="text/javascript" src="static/js/jquery.min.js"></script>
    <script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
</head>
<body>
<h2>Basic DataGrid</h2>
<p>The DataGrid is created from markup, no JavaScript code needed.</p>
<div style="margin:20px 0;"></div>

<table id="gb" class="easyui-datagrid" title="Basic DataGrid" style="width:700px;height:250px"
       data-options="singleSelect:true,collapsible:true,onSelect:onSelectRow">
    <thead>
    <tr>
        <th data-options="field:'itemid',width:80">Item ID</th>
        <th data-options="field:'productid',width:100">Product</th>
        <th data-options="field:'listprice',width:80,align:'right'">List Price</th>
        <th data-options="field:'unitcost',width:80,align:'right'">Unit Cost</th>
        <th data-options="field:'keluo',width:250">Attribute</th>
        <th data-options="field:'status',width:60,align:'center'">Status</th>
    </tr>
    </thead>
</table>
<input class="easyui-textbox" id="name" name="name" data-options="onChange:onChangeTextBox"/>
<br/>
<input id="numberBox">
<script>
    $("#numberBox").numberbox({
        min:200,
        max:1000000000,
        suffix:'€',
        precision:2,
        groupSeparator:','
    });
    function onChangeTextBox(newValue,oldValue) {
//        alert(oldValue);
    }

    function onSelectRow() {
//        alert("I'm on select now");
        $("#name").textbox("setValue","中华人民共和国");
        alert($("#name").textbox("getValue"));
    }
    $(function () {

        var json_data=[
            {itemid:"0001",productid:"1111",listprice:"98",unitcost:"段落",keluo:"weAre",status:"待定"},
            {itemid:"0002",productid:"2222",listprice:"98",unitcost:"段落",keluo:"weAre",status:"是"},
            {itemid:"0003",productid:"2222",listprice:"98",unitcost:"段落",keluo:"weAre",status:"否"},
        ];
        $("#gb").datagrid({
                data:json_data,
                onSelect:onSelectRow
            }
        );
    });

</script>
</body>
</html>